Skip to content

feat(mcp): add remote + stdio + CLI surfaces for the selftune override audit#7997

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
michiot05:feat/mcp-selftune-override-audit
Jul 22, 2026
Merged

feat(mcp): add remote + stdio + CLI surfaces for the selftune override audit#7997
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
michiot05:feat/mcp-selftune-override-audit

Conversation

@michiot05

Copy link
Copy Markdown
Contributor

Summary

  • Closes Self-tune override audit trail (selftune/overrides/audit) has no remote MCP tool, local stdio MCP tool, or CLI verb #7798: give the self-tune override audit trail the same three-surface reach as its gate-precision sibling — remote MCP, local stdio MCP, and a maintain selftune-audit CLI verb — instead of raw REST only.
  • Remote tool (src/mcp/server.ts): loopover_get_selftune_override_audit, category "maintainer", input owner/repo + optional limit (mirroring the route's ?limit query), calling the same listOverrideAudit the REST route uses and returning its exact { repoFullName, audit } shape. Same per-repo read gate as loopover_get_gate_precision (requireRepoAccess), per the issue's required pattern.
  • Stdio tool (packages/loopover-mcp/bin/loopover-mcp.ts): proxies GET {repoBase}/selftune/overrides/audit via apiGet, forwarding ?limit only when set — same shape as the loopover_get_gate_precision stdio registration.
  • CLI verb: maintain selftune-audit --repo owner/repo [--limit N] [--json], following the precision subcommand's structure exactly (same emit/--json handling, same query-building), wired into the subcommand list, maintain --help, the unknown-subcommand message, and the top-level usage line.
  • listOverrideAudit, the REST route, and its requireRepoMaintainer gate are untouched — this only adds the three missing mirror surfaces.
  • Tests: a remote-tool regression test mirroring loopover_get_gate_precision's own (test/unit/mcp-selftune-override-audit.test.ts: repo-scoped rows + limit pass-through, empty trail, forbidden identity), plus in-process bin coverage for the CLI dispatcher AND stdio tool via the exported maintainCli / server + InMemoryTransport (test/unit/mcp-cli-selftune-audit.test.ts, same loopover_plan_repo_issues has no REST route, CLI command, or local stdio MCP tool #7764 entrypoint-guard pattern as mcp-cli-plan-issues), covering both sides of every new branch (--limit present/absent, detail-bearing/detail-less events, audit-less payload, unknown-subcommand fall-through, help text). Tool-count pin bumped 100 → 101 in mcp-tool-rename-aliases; packages/loopover-mcp/bin/** confirmed in vitest coverage.include.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • None skipped — the full npm run test:ci gate was run from the repo root (it includes every check above plus the drift checks) and passed, followed by npm audit --audit-level=moderate. The audit reports pre-existing advisories already present on main's dependency tree (fast-uri, and @hono/node-server transitively under @modelcontextprotocol/sdk / @cloudflare/codemode / agents) — this PR changes no dependencies, and those advisories are already being addressed by the open Renovate updates.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

Not applicable — backend MCP/CLI surfaces only; no visible UI, frontend, docs, or extension change.

Notes

  • MCP contract note: tools/list gains loopover_get_selftune_override_audit (category maintainer) with an output schema (repoFullName, audit); audit rows stay schema-opaque (z.unknown()) because listOverrideAudit is their single source of truth, matching gatePrecisionOutputSchema's sub-report pattern. No REST or OpenAPI surface changed, so no regenerated artifacts were needed (command-reference:check, docs:drift-check, manifest:drift-check all pass unchanged).
  • The forbidden path is an error result (same as the gate-precision family's requireRepoAccess throw), so the output schema carries no status arm.

…e audit

Closes JSONbored#7798. Mirrors loopover_get_gate_precision's three-surface shape:
loopover_get_selftune_override_audit as a remote MCP tool (category
maintainer, owner/repo + optional limit, same requireRepoAccess read gate)
and local stdio tool (GET {repoBase}/selftune/overrides/audit via apiGet),
plus a 'maintain selftune-audit --repo owner/repo [--limit N]' CLI verb
following the precision subcommand's emit/--json structure. listOverrideAudit,
the REST route, and its gate are untouched. Tool-count pin 100 -> 101;
PowerShell completer pin updated.
@michiot05
michiot05 requested a review from JSONbored as a code owner July 22, 2026 03:23
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 22, 2026
@loopover-orb

loopover-orb Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-22 03:34:40 UTC

9 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR mirrors an already-live REST route (`GET /selftune/overrides/audit`) onto the remote MCP tool, stdio MCP tool, and CLI verb, closely following the existing `loopover_get_gate_precision`/`precision` triad pattern end-to-end (shape, category, gate, help text, tool-count pin). The wiring is consistent across all three surfaces — same `requireRepoAccess` gate on the remote tool, same `?limit` forwarding logic on stdio/CLI, and the tool-count assertions (100→101) and CLI usage/help strings are updated everywhere they appear. Tests cover both branches of the new `--limit` logic, detail-bearing vs detail-less audit rows, the audit-less payload fallback, and the unknown-subcommand fall-through.

Nits — 4 non-blocking
  • test/unit/mcp-cli-selftune-audit.test.ts:35 sets `LOOPOVER_API_TOKEN = "in-process-token"` for the fixture harness — this is a hardcoded test placeholder, not a real credential, but worth confirming it matches the existing convention in sibling `mcp-cli-*.test.ts` files.
  • packages/loopover-mcp/bin/loopover-mcp.ts:3148 and :3958 use `any` for the stdio tool handler and CLI event-mapping params — consistent with the file's existing style for sibling tools (e.g. gate-precision), so not a new deviation, but still loose typing worth tightening file-wide at some point.
  • Consider narrowing the `any` types on the new `registerStdioTool` handler (packages/loopover-mcp/bin/loopover-mcp.ts:3148) and the `audit.map((event: any) => ...)` callback (packages/loopover-mcp/bin/loopover-mcp.ts:3958) to a shared `OverrideAuditEvent` type instead of `any`, matching the return shape from `listOverrideAudit`.
  • Possible secret-shaped assignment in the diff (generic_secret_assignment) — Verify the value is not a real credential.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #7798
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 8 registered-repo PR(s), 1 merged, 2 issue(s).
Contributor context ✅ Confirmed Gittensor contributor michiot05; Gittensor profile; 8 PR(s), 2 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Partially addressed
The PR adds the remote MCP tool, stdio MCP tool, and CLI verb for the override audit, closely mirroring gate-precision's three surfaces as requested, but it deviates from the issue's explicit gate requirement by using requireRepoAccess instead of the same requireRepoMaintainer/requireRepoAccess gate the issue says must mirror loopover_get_gate_precision exactly (the issue emphasizes the same requi

Review context
  • Author: michiot05
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 8 PR(s), 2 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 050f8cb into JSONbored:main Jul 22, 2026
10 checks passed
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.13%. Comparing base (7c1a21e) to head (67f30bf).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7997      +/-   ##
==========================================
- Coverage   91.91%   83.13%   -8.78%     
==========================================
  Files         739       96     -643     
  Lines       75854    25176   -50678     
  Branches    23018     4802   -18216     
==========================================
- Hits        69723    20931   -48792     
+ Misses       5038     3994    -1044     
+ Partials     1093      251     -842     
Flag Coverage Δ
shard-1 23.50% <22.72%> (-34.95%) ⬇️
shard-2 23.11% <45.45%> (-28.91%) ⬇️
shard-3 35.67% <77.27%> (-14.37%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-mcp/bin/loopover-mcp.ts 17.96% <100.00%> (+0.51%) ⬆️
src/mcp/server.ts 96.73% <100.00%> (+0.02%) ⬆️

... and 643 files with indirect coverage changes

@github-actions github-actions Bot mentioned this pull request Jul 22, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Self-tune override audit trail (selftune/overrides/audit) has no remote MCP tool, local stdio MCP tool, or CLI verb

1 participant